package com.freestyle.seatabusiness.account.controller;

import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import com.freestyle.common.JsonUtils;
import com.freestyle.common.ResponseEntity;
import com.freestyle.seatabusiness.api.service.AccountServiceQuery;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Created by rocklee on 2022/3/26 18:19
 */
@RestController
@RequestMapping("/account")
public class AccountController {
  @Resource
  private AccountServiceQuery accountServiceQuery;
  @GetMapping("/list")
  @ResponseBody
  public Object getList(@RequestParam("p")String prefix) {
    return JsonUtils.toJsonString(accountServiceQuery.getAccountList(prefix,1,20));
  }
  @GetMapping("/rules")
  @ResponseBody
  public Object getRules() {
    return ResponseEntity.fromResult(0, FlowRuleManager.getRules());
  }
}
